package yao.xerophyte.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("springDataRestTest")
public class SpringDataRedisTest {
    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    @PostMapping("set")
    public String setValue(){
        redisTemplate.opsForValue().set("testKey","testValue");
        return "success";
    }
    @GetMapping("get")
    public String getValue(){
        return redisTemplate.opsForValue().get("testKey");
    }
    
}
